From the 3rd century BC, Chinese sources refer to the Xiongnu, a confederacy of nomad tribes threatening their northern borders.
The nearest Chinese states built defensive walls against them which were consolidated and extended by the first Emperor of China after 214 BC when he also seized the Ordos region from the Xiongnu, driving them north.
The accession of the dynamic Xiongnu leader, Mao-dun, in 209 BC, however, began a period of Xiongnu aggression in which they subdued or drove away the other nomad nations of the region and brought China into a humiliating and expensive tributary relationship that lasted more than sixty years.
During this time the Xiongnu gained control of the Western Regions, the rich agricultural lands of the Tarim Basin, from which they gained taxes, manpower and a supply of weapons.
After 134 BC China gradually regained control of this key area, through which lucrative trade with the west had to pass, and by AD 48 they had split the Xiongnu, incorporating the southern branch into the Han Empire, and breaking the power of the northern branch.